<?php
/**
 * Description of TabelaMeta
 *
 * @author Magno
 */
class TableMeta {
    
    private $name;
    private $attributes;
    private $FKReferences;
    private $FKReferenciadas;
    private $crud;
    
    function __construct($name = "", $attributes = null, $FKReferences = null, $FKReferenciadas = null, $crud = true) {
        $this->name = $name;
        $this->attributes = $attributes;
        $this->FKReferences = $FKReferences;
        $this->FKReferenciadas = $FKReferenciadas;
        $this->FKReferenciadas = array();
        $this->crud = $crud;
    }

    public function getName() {
        return $this->name;
    }

    public function setName($name) {
        $this->name = $name;
    }

    public function getAttributes() {
        return $this->attributes;
    }

    public function setAttributes($attributes) {
        $this->attributes = $attributes;
    }

    public function getFKReferences() {
        return $this->FKReferences;
    }

    public function setFKReferences($FKReferences) {
        $this->FKReferences = $FKReferences;
    }

    public function getFKReferenciadas() {
        return $this->FKReferenciadas;
    }

    public function setFKReferenciadas($FKReferenciadas) {
        $this->FKReferenciadas = $FKReferenciadas;
    }

    public function addFKReferenciada($FKReference){

        if($this->FKReferenciadas == null || !isset ($this->FKReferenciadas))
            $this->FKReferenciadas = array();

        $this->FKReferenciadas[$FKReference->getName()] = $FKReference;

    }
    
    public function isCrud() {
        return $this->crud;
    }

    public function setCrud($crud) {
        $this->crud = $crud;
    }

}

?>
